<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta charset="utf-8">
	<title>后台用户管理</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="../layui/css/layui.css" media="all">
	<style>
		.blogUser-con .layui-table-view {
			border: none;
		}
		
		.blogUser-con .layui-table-box {
			margin-top: 10px;
		}
		
		.blogUser-con {
			padding: 0 15px 15px 15px;
			margin-bottom:50px;
		}
		.blogUser-con  .layui-table-tool-self{
			display:none;
		}
		.blogUser-con .not_border_left {
			border-left: none !important;
		}
		
		.blogUser-con .blogUser dl dd.layui-this {
			background-color: #1E9FFF !important;
		}
		
		.blogUser-con .hide {
			display: none;
		}
		
		.blogUser-con .show {
			display: block;
		}
		
		.blogUser-con .btn_size {
			height: 28px !important;
			line-height: 28px !important;
		}
		
		.blogUser-con .layui-table-body table tbody .layui-table-hover {
			background: #fffdd3 !important;
		}
		
		.blogUser-con .layui-table-body table tbody .layui-table-click {
			background: #fdef9b !important;
		}
		
		.blogUser-con .layui-table, .layui-table-view {
			border: none;
			margin-top: 0;
		}
		
		#add-AdminUser {
			display: none;
			z-index: 999 !important;
		}
		
		#add-AdminUser .artTypeLayer {
			width: 90%;
			margin-left: auto;
			margin-right: auto;
			padding-top: 20px;
		}
		.adminuserdetail{
			padding:20px;
			display: none;
		}
		.adminuserdetail table tr td{
			padding: 15px;text-align: center;
		}
		.adminuserdetail .tdbck{
			background: #f2f2f2;
			width: 30%;
		}
	</style>
</head>
<body>

	<div class="blogUser-con">
		<blockquote class="layui-elem-quote not_border_left">
			<form class="layui-form" action="">
			  	<div class="layui-input-inline">
			  		<input type="hidden" name="roleid" id="roleid" class="layui-input">
					<input type="text" name="queryrealname" id="queryrealname" placeholder="请输入查询内容" class="layui-input" autocomplete="off">
			    </div>
			    <div class="layui-inline">
	     	   		<button id="btnselfrontinfo" type="button" class="layui-btn layui-bg-blue">查询</button>
			    </div>
			</form>
		</blockquote>

		<script type="text/html" id="barDemo">
			<a class="layui-btn layui-btn-xs" id="add" lay-event="add">授予</a>
		</script>

		<!-- 表格开始 -->
		<table class="layui-hide" name="powerinfo" id="powerinfo" lay-filter="powerinfo"></table>
		<!-- 表格结束 -->
		
	</div>
	<script src="../js/jquery-3.3.1.js" charset="utf-8"></script>
	<script src="../layui/layui.js" charset="utf-8"></script>
	<script src="../js/loadselect.js" charset="utf-8"></script>
	<script>
	layui.use([ 'table', 'form', 'layer', 'laydate', 'laytpl', 'element' ], function() {
		var table = layui.table, form = layui.form, 
			layer = layui.layer, $ = layui.jquery,
			laydate = layui.laydate, laytpl = layui.laytpl,
			element = layui.element;
	
		/*加载表格*/
		table.render({
			elem : '#powerinfo',
			id:'powerinfo',
			url : '../systemmodel/getallsystemmodel',
			title : '后台管理员用户数据表',
			height: 275,
			skin : 'line',
			even : true,
			cols : [ 
			     [ 
			     {
					field : 'id',
					title : 'ID',
					hide: true ,
					width:160
				}, {
					field : 'name',
					align : 'center',
					title : '菜单名称',
					width : 170,
				}, {
					field : 'chinesename',
					align : 'center',
					title : '展示名称',
					width : 170,
				}, {
					field : 'deepth',
					title : '菜单层次',
					align : 'center',
					width : 170,templet:function(d){
			    		 return d.deepth == "1" ? "一级菜单" : "二级菜单"}
				},{
					title : '操作',
					toolbar : '#barDemo',
					align : 'center',
					width : 160,
				} ] 
			 ],
			 page: {
					layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
					groups: 5,
					limit: 5,
					limits: [5, 10, 30, 40, 50],
					theme: '#1E9FFF',						
			 },
		});
		/*加载表格结束*/
		
		//table监听工具条
		table.on('tool(powerinfo)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
		  var data = obj.data; //获得当前行数据
		  var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
		  var tr = obj.tr; //获得当前行 tr 的DOM对象
		 
		  var roleid = $("#roleid").val();
		  if(roleid == 00){
		  	layer.msg("请选择角色");
			return;
		  }
		  
		  if(layEvent === 'add'){ //赋予权限
		  
		      	$.post("../systemmodel/addrolepower",{id:obj.data.id,roleid:roleid},function(flag){
		      		//alert(flag.code)
	    			if(flag.code == 0){
	    				layer.msg(flag.msg,{icon:6});
	    			}else{
	    				layer.msg(flag.msg,{icon:5});
	    				return;
	    			}
		    	});
		  }
	});
		
		
});
	
	</script>
</body>
</html>